package cn.itsource.wechart.controller;
import cn.itsource.basic.util.AjaxResult;
import cn.itsource.wechart.pojo.domain.WechartProperties;
import cn.itsource.wechart.pojo.dto.BinderDto;
import cn.itsource.wechart.service.WeChartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping("/wechart")
public class WeChartController {
//    注入微信第三方接口的domain
    @Autowired
    private WechartProperties wechartProperties;
    @Autowired
    private WeChartService service;
//    点页面微信的接口
    @GetMapping("/toLogin")
    public String toLogin(){
        return service.toLogin();
    }
    /**
     * 扫码后的接口
     */
    @GetMapping("/callback")
    public String ccallBack(String code){
        return service.callback(code);
    }
/**
 * 绑定的接口(将第三方数据用户绑定到本地数据表中)
 *
 */
@PostMapping("/binder")
@ResponseBody
public AjaxResult binder(@RequestBody BinderDto binderDto) {
    //调用service
    return service.binder(binderDto);
}


}
